/*--------------------------------------------------------------------------------------*\
**
** t_adventure_event_replay.h
**
** Heroes IV
** Copyright 2000, The 3DO Company
**
\*--------------------------------------------------------------------------------------*/

#if !defined( ADVENTURE_OBJECT_GLOABL_ID_H_INCLUDED)
#define ADVENTURE_OBJECT_GLOABL_ID_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <streambuf>


// --------------------------------------------------------------------------
// t_adventure_global_id type
// --------------------------------------------------------------------------
typedef unsigned int t_adventure_global_id;

// These two would become member function sof the t_adventure_global_id type if it ever becomes a class
t_adventure_global_id	read_adventure_global_id( std::streambuf &buffer );
void					write_adventure_global_id( std::streambuf &buffer, t_adventure_global_id id );


// --------------------------------------------------------------------------
// t_adventure_global_id_factory class
// --------------------------------------------------------------------------
const t_adventure_global_id				k_invalid_global_id = 0;
const t_adventure_global_id				k_first_valid_adventure_global_id = 1;

class t_adventure_global_id_factory 
{
public:
	t_adventure_global_id_factory();

	t_adventure_global_id	get_new_id();
	t_adventure_global_id	get_id_counter();
	void					set_id_counter( t_adventure_global_id const & new_id );
	
	void					read( std::streambuf &buffer );
	void					write( std::streambuf &buffer );
	
private:
	t_adventure_global_id	m_id_counter;
};


#endif // ADVENTURE_OBJECT_GLOABL_ID_H_INCLUDED

